<html>
<head>
<!--meta http-equiv="refresh" content="1" /-->
<title>My first page in PHP.</title>
</head>
<body>
	<?php 

	/*
	 * Checks if the form was submitted
	*/
	if($_SERVER['REQUEST_METHOD'] == 'POST') {
		// Displays the submitted information
		echo "Thanks for registering! <br />",
		"Username: ", htmlentities($_POST['username']), "<br />",
		"Email: ", htmlentities($_POST['email']), "<br />";
	} else {
		// If the form was not submitted, displays the form

		?>
	<form action="index.php" method="post">
		<label for="username">Username:</label> <input type="text"
			name="username" /> <label for="email">Email:</label> <input
			type="text" name="email" /> <input type="submit" value="Register!" />
	</form>

	<?php } // End else statement ?>
	Current date :
	<script type="php"> print(date("l F d, Y"));
	echo "<br>";
	echo "Hello World"; </script>
	<br />
	<?='Some text to output.'?>
	<?php
	$foo = "5"; // This is considered a string
	$bar = $foo + 2; // This converts $foo to an integer (outputs 7)
	echo '<br>';
	echo "foo = $foo";
	echo '<br>';
	echo "bar = \$bar<br/>";
	echo $foo . $bar.'<br/>';
	$condition=true;
	if($condition===true)
	{
		echo 'The condition is true!';
	}
	else
	{
		echo 'The condition is false!';
	}
	echo '<br>';
	?>
	<?php 
	$entry = array('Sample Title', 'April 13, 2009', 'Jason',
			'Today, I wrote a blog entry.');

	echo $entry[0], ' by ', $entry[2],'<br/>';
	?>
	<?php 
	$person = array('name' => 'Jason', 'age' => 23);

	echo "This person's name is {$person['name']}
	and he is {$person['age']}.<br>";

	echo "This person's name is ".$person['name'].
	" and he is {$person['age']}.<br>";
	echo "This person's name is $person[name] and he is $person[age].<br>";
	?>
	<?php 
	$people = array(
			array('name' => 'Jason', 'age' => 23), // $people[0]
			array('name' => 'Carly', 'age' => 18) // $people[1]
	);

	echo "{$people[0]['name']} of {$people[0]['age']} years has a sister named {$people[1]['name']} who is
	{$people[1]['age']} years old.".'<br>';
	?>
	<?php 
	$colors = array(
			'fruits' => array('apple' => 'red', 'plum' => 'purple'),
			'flowers' => array('rose' => 'red', 'violet' => 'blue')
	);

	// Output: An apple is red, and a violet is blue.
	echo "An apple is {$colors['fruits']['apple']}, and a
	violet is {$colors['flowers']['violet']}.<br>";
	?>
	<?php 
	$amt1 = 2.55;
	$amt2 = 3.55;
	$total = $amt1 + $amt2;

	printf('The total cost is $%.5f<br>', $total);
	?>
	<?php
	@include_once 'fake_file';
	echo 'Math Error';
	?>
	<?=time()?>
</body>
</html>
